import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1


Window {
    id:win_home
    visible: true
    width: 480
    height: 360
    title: qsTr("Login_Page")
    SelectData
    {
        id:select_data
    }

    MainForm {
            AnimatedImage   //动画图
            {
                id:png
                width: 480
                height: 150
                source: "images/png.gif"
            }

            Text            //用户名称
            {
                id:textname
                x:80
                y:png.y + png.height + 20;//文本顶部距离rocket图片底部20
//                anchors.horizontalCenter: parent.horizontalCenter//文字居中
                text:"用户名:"
                color: "Black"
                font.family: "楷体"; //设置字体
                font.pixelSize: 25;//字体大小

            }

            Text              //密码
            {
                id:textPsd
                x:80
                y:png.y + png.height + 70;//文本顶部距离rocket图片底部70
                text:"密  码:"
                color: "Black"
                font.family: "楷体"; //设置字体
                font.pixelSize: 25;//字体大小
            }
            TextField{               //用户名输入
//                 anchors.verticalCenter: parent.verticalCenter
                x:180
                y:png.y + png.height + 18;//输入框顶部距离rocket图片底部18
                 width:200
                 height:28
                 id:textfield_Name
//                 text: testUserModel.Name
//                 onEditingFinished: {
//                     testUserModel.Name = textfield_Name.text;
//                    }
            }
            TextField{               //密码输入
                x:180
                y:png.y + png.height + 68;//输入框顶部距离rocket图片底部68
                 width:200
                 height:28
                 id:textfield_Psd
//                 text: testPsdModel.Psd
//                 onEditingFinished: {
//                     testPsdModel.Name = textfield_Psd.text;
//                    }
            }

            Component{             //登录与退出按钮
                   id: btnStyle;
                   ButtonStyle {
                       background: Rectangle {
                           implicitWidth: 70;
                           implicitHeight: 25;
                           color: "#DDDDDD";
                           border.width: control.pressed ? 2 : 1;
                           border.color: (control.hovered || control.pressed) ? "green" : "#888888";
                       }
                   }
               }

               Button {
                   id: openButton;
                   text: "登录";
                   onClicked:{
                       select_data.show();
//                       win_home.lower();
                   }
                   anchors.left: parent.left;
                   anchors.leftMargin: 100;
                   anchors.bottom: parent.bottom;
                   anchors.bottomMargin: 60;
                   style: btnStyle;
               }

               Button {
                   text: "退出";
                   onClicked: Qt.quit();
                   anchors.left: openButton.right;
                   anchors.leftMargin: 150;
                   anchors.bottom: openButton.bottom;
                   style: btnStyle;
               }
        anchors.fill: parent
        color: "gray"
    }
}
